package com.bubblegumproject.ogo.swing.events;

import org.jdesktop.swingx.JXHyperlink;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * Condition triggered when a JXHyperLink is clicked.
 *
 * @author Azubuko Obele (buko.obele@gmail.com)
 */
public class LinkClickedCondition extends AbstractCondition {

    public LinkClickedCondition(final  JXHyperlink link) {
        assert(link != null);
        link.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                occured();
            }
        });
    }

    public static LinkClickedCondition LinkClicked(JXHyperlink link) {
        return new LinkClickedCondition(link);
    }
}
